<?php 
	include("includes/connect_db.php"); 

	passthru("net start > service.log");
	$handle = fopen("service.log", "r");
	while (!feof($handle))
	{
	   $baristeks = fgets($handle);
	   if (substr_count($baristeks, 'Gammu SMSD Service (GammuSMSD)') > 0)
	   {
	     $status = 1;
	   }
	}
	fclose($handle);
	if ($status == 0) {
		passthru('C:\Gammu\bin\gammu-smsd -c smsdrc -s');
	}
?>